﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KnowledgeAssistant
{
    public class User
    {
        private int user_id;
        private string name;
        private string password;
        private Role role;
        private object owner;
        private int owner_type_id;
        
        public User(int user_id, string name, string password, Role role, object owner)
        {
            this.user_id = user_id;
            this.name = name;
            this.password = password;
            this.role = role;
            this.owner = owner;
            if (owner is Student)
            { owner_type_id = 1; }
            else if (owner is Teacher)
            { owner_type_id = 2; }
            else
            { owner_type_id = 0; }
        }

        public User()
        {
                  
        }

        public int ID
        {
            get { return this.user_id; }
        }

        public string Name
        {
            get { return this.name; }
        }

        public Role Role
        {
            get { return this.role; }
        }

        public void Dispose()
        {
            this.role.Dispose();
            this.role = null;
        }

        public object Owner
        {
            get { return this.owner; }
            set { this.Owner = value; }
        }

        public string Password
        {
            get { return this.password; }
        }

        public int OwnerType
        {
            get { return this.owner_type_id; }
            set{ this.owner_type_id = value; }
        }
    }
}
